package org.lemon.transport.context.utils;

import org.springframework.util.Base64Utils;

import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;

public class SslUtil {

    public static String getCertificateString(Certificate cert)
            throws CertificateEncodingException {
        return EncryptionUtil.certTrimNewLines(Base64Utils.encodeToString(cert.getEncoded()));
    }

    public static String getCertificateHash(String StrCert) {
        return EncryptionUtil.getSha3Hash(StrCert);
    }
}
